package com.kedacom.emptyproject.viewmodel

import com.kedacom.emptyproject.model.bean.ResultBean
import com.kedacom.lego.mvvm.ObservableLiveDataField
import com.kedacom.util.LegoLog
import java.util.*


class MainViewModel : BaseViewModel() {

    // 日历绘制所需任务情况集合
    var scheduleList = ObservableLiveDataField<List<ResultBean>>()

    private fun getScheduleData() {
        val calendar = Calendar.getInstance()
        calendar.time = Date()
        val year = calendar.get(Calendar.YEAR)
        val month = calendar.get(Calendar.MONTH) + 1
        LegoLog.d(" year$year  month$month")
        getScheduleTask(year, month)
    }

    fun getScheduleTask(year: Int, month: Int) {
        LegoLog.d("选中：的年=${year},月=${month}：")
        showToast("具体业务逻辑，需要借助服务端接口")
//        val policeNo = WorkBenchSP.policeNo
//        val param = "policeNo=$policeNo&year=$year&month=$month"
//        HttpServicesFactory.getHttpServiceApi()
//            .getScheduleTask(WorkBenchSP.iDNo, WorkBenchSP.deviceId, param, "getScheduleTask")
//            .enqueue(object : HttpRequestCallback<ScheduleData>() {
//                override fun onSuccess(result: ScheduleData) {
//                    super.onSuccess(result)
//                    if (result != null && result.list != null && result.list.isNotEmpty()) {
//                        scheduleList.value = result.list
//                    }
//                }
//
//                override fun onFailure(status: Int, message: String?) {
//                    super.onFailure(status, message)
//                }
//            })
    }
}
